home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
cpphtp2
/
code.jar
/
code
/
ch11
/
fig11_28.txt
< prev
next >
Wrap
Text File
|
1998-02-27
|
973b
|
28 lines
1 // Fig. 11.28: fig11_28.cpp
2 // Demonstrating the flags member function.
3 #include <iostream.h>
4
5 int main()
6 {
7 int i = 1000;
8 double d = 0.0947628;
9
10 cout << "The value of the flags variable is: "
11 << cout.flags()
12 << "\nPrint int and double in original format:\n"
13 << i << '\ ' << d << "\n\n";
14 long originalFormat =
15 cout.flags( ios::oct | ios::scientific );
16 cout << "The value of the flags variable is: "
17 << cout.flags()
18 << "\nPrint int and double in a new format\n"
19 << "specified using the flags member function:\n"
20 << i << '\ ' << d << "\n\n";
21 cout.flags( originalFormat );
22 cout << "The value of the flags variable is: "
23 << cout.flags()
24 << "\nPrint values in original format again:\n"
25 << i << '\ ' << d << endl;
26 return 0;
27 }